Repository navigation
关注刷新和 MCP 的 get_follows 改成按关注分组读名单 - #466
Merged
Merged
Conversation
已有完整名单时,刷新第 1 步用 x/relation/tag 按分组读(一页 500 人),不再逐页读 followings(一页 50 人)。新关注的人从 followings 第 1 页往后补关注时间;人数和 B站 总数对不上就退回逐页读。MCP 的 get_follows 没同步过时也用同一个函数读整份名单,query 能用了。
# Conflicts: # extension/triage/follow-bg.selftest.js
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
有用户反馈关注 4000 多个时刷新很慢。第 1 步每次都逐页读 followings,一页最多 50 人,4000 人要 80 个请求,连着翻还容易被限流。
x/relation/tag,一页 500 人,x/relation/tags说没人的分组不读)。分进自定义分组的人不在默认分组里,所有分组合起来就是全部关注,按 mid 去重。4000 人约 10 个请求。有人的分组第 1 页回空当作可能的风控,再问一次。followReadGroups,MCP 的get_follows没同步过时也用它读整份名单,query能用了,读全的结果缓存 3 分钟供翻页。MCP 同样核对总数,读不全就退回原来的读一页,且不缓存。MCP 用自己的请求方式,限流直接报 THROTTLED,不走关注队列的 90 秒等待,避免超过一次调用的时限。验证:
node scripts/selftest.mjs50 项通过,cd mcp && npm test22 项通过。用真实登录(971 人)实测:没测:关注超过 1000 人或有多个自定义分组的账号;从 MCP 客户端走完整一趟(端口被正在用的 MCP 服务占着)。不带上下文的子 agent 审过 diff,确认的问题已修。
mcp/server.js只改了get_follows的说明,发版时要提升 MCP 版本号 npm 才会发新版。